package com.stx.day0910;
import java.util.Scanner;

public class Calculator {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        boolean running = true;

        while (running) {
            // 显示欢迎界面
            System.out.println("****************************");
            System.out.println("***欢迎使用计算器***");
            System.out.println("***请输入对应数字***");
            System.out.println("*****1、加法*******");
            System.out.println("*****2、减法*******");
            System.out.println("*****3、乘法*******");
            System.out.println("*****4、除法*******");
            System.out.println("*****5、退出*******");
            System.out.println("****************************");
            System.out.print("请选择操作（1-5）：");

            int choice = scanner.nextInt();
            switch (choice) {
                case 1:// 加法
                    System.out.println("请输入两个加数");
                    double num1 = scanner.nextDouble();
                    double num2 = scanner.nextDouble();
                    double sum = addtion(num1,num2);
                    System.out.println(sum);
                    break;
                case 2:// 减法
//                    subtraction();
                    break;
                case 3:// 乘法
//                    multiplication();
                    break;
                case 4:// 除法
//                    division();
                    break;
                case 5:
                    System.out.println("感谢使用计算器，再见！");
                    running = false;
                    break;
                default:
                    System.out.println("输入错误，请输入1-5之间的数字！");
            }
            System.out.println(); // 空行分隔
        }
    }
    public static double addtion(double num1, double num2){
        return num1+num2;
    }
    public static double subtraction(double num1,double num2){
        return num1-num2;
    }
    public static double multiplication(double num1,double num2){
        return num1*num2;
    }
    public static double division(double num1,double num2){
        return num1/num2;
    }
}